import request from '@/utils/request'
export function reqGetEmployeeList (page, size) {
  return request({
    methods: 'get',
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}

export function reqDelEmployee (id) {
  return request({
    method: 'delete',
    url: `/sys/user/${id}`
  })
}

export function reqAddEmployee (data) {
  return request({
    method: 'post',
    url: '/sys/user',
    data
  })
}

export function reqImportEmployee (data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

export function addEmployee (data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

// 获取员工基本信息 (包含头像)
export function reqGetUserDetailById (id) {
  return request({
    method: 'get',
    url: `/sys/user/${id}`
  })
}

/** *
 *  读取用户详情的基础信息 (个人详情-下面的接口)
 * **/
export function reqGetPersonalDetail (id) {
  return request({
    method: 'get',
    url: `/employees/${id}/personalInfo`
  })
}

// 保存员工基本信息
export function reqSaveUserDetailById (data) {
  return request({
    method: 'put',
    url: `/sys/user/${data.id}`,
    data
  })
}

/** *
 *  更新用户详情的基础信息 (个人详情-下面的接口)
 * **/
export function reqUpdatePersonal (data) {
  return request({
    method: 'put',
    url: `/employees/${data.userId}/personalInfo`,
    data
  })
}

/** **
 * 获取用户的岗位信息  (岗位信息)
 * ****/
export function reqGetJobDetail (id) {
  return request({
    method: 'get',
    url: `/employees/${id}/jobs`
  })
}

/**
 * 保存岗位信息  (岗位信息)
 * ****/
export function reqUpdateJob (data) {
  return request({
    method: 'put',
    url: `/employees/${data.userId}/jobs`,
    data
  })
}
/**
 * 获取员工的简单列表
 * **/
export function reqGetEmployeeSimple () {
  return request({
    url: '/sys/user/simple'
  })
}
